package com.bwsoft.admin.action;

import java.io.PrintWriter;
import java.util.Date;
import java.util.List;

import net.sf.json.JSONObject;

import org.apache.log4j.Logger;

import com.bwsoft.admin.domain.Report;
import com.bwsoft.admin.domain.valueObject.ReportVO;

public class ReportAction extends BaseAction_ybd{

	/**
	 * 
	 */
	private static final long serialVersionUID = -4100249695810278912L;
	private static Logger LOG = Logger.getLogger(ReportAction.class);
	public String s_reportNumber;
	public String s_sampleName;
	public String s_danwei;
	public String s_shangchuan;
	public String s_start;
	public String s_end;
	
	
	public String getS_reportNumber() {
		return s_reportNumber;
	}


	public void setS_reportNumber(String s_reportNumber) {
		this.s_reportNumber = s_reportNumber;
	}


	public String getS_sampleName() {
		return s_sampleName;
	}


	public void setS_sampleName(String s_sampleName) {
		this.s_sampleName = s_sampleName;
	}


	public String getS_danwei() {
		return s_danwei;
	}


	public void setS_danwei(String s_danwei) {
		this.s_danwei = s_danwei;
	}


	public String getS_shangchuan() {
		return s_shangchuan;
	}


	public void setS_shangchuan(String s_shangchuan) {
		this.s_shangchuan = s_shangchuan;
	}

	public String getS_start() {
		return s_start;
	}


	public void setS_start(String s_start) {
		this.s_start = s_start;
	}


	public String getS_end() {
		return s_end;
	}


	public void setS_end(String s_end) {
		this.s_end = s_end;
	}


	//--------------------------------------------------------
	public String reportIndex(){
		return "reportIndex";
	}
	
	/**
	 * 标准查询获取列表
	 */
	public String getReportJson() {

		List<Report> reportSet=null;
			//通过字典编号查询字典详情的分页集合
		reportSet = reportService.findData(page, rows, s_reportNumber,  s_sampleName, s_danwei, s_shangchuan, s_start, s_end);
			//通过编号查询字典集合的大小	
		Long count = reportService.getTotalCount(s_reportNumber,  s_sampleName, s_danwei, s_shangchuan, s_start, s_end);
		
		List<ReportVO> listVo = reportService.getVo(reportSet);
		
		responseJson.put("total", count);
		responseJson.put("rows", listVo);

		return "mapJsonResult";
	}
	
	/**
	 * 删除
	 * @return
	 */
	public String removeReport(){
		msg = reportService.remove(report.getReportId());
		responseJson.put("result", msg.getMsgFlag() ? "Success" : "Fail");
		responseJson.put("message", msg.getMsgStr());
		return "mapJsonResult";
	}
}
